package com.example.newdemo.view.bind;

import android.app.Activity;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;

import androidx.annotation.Nullable;

import com.example.newdemo.IBooksAidl;

public class BinderActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    private ServiceConnection connection=new ServiceConnection() {
        /**
         * 服务解除绑定时候调用
         */
        @Override
        public void onServiceDisconnected(ComponentName name) {
            // TODO Auto-generated method stub

        }
        /**
         * 绑定服务的时候调用
         */
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            IBooksAidl binder=  IBooksAidl.Stub.asInterface(service);
            try {
                int index=binder.getTypes();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    };






}
